import java.io.*;

public class ReaderWriterDemo {
    public static void main(String[] args) throws IOException {

        testWriter();
        testReader();
    }

    public static void testWriter() throws IOException {
        Writer w=new FileWriter("e:/03chenhaisheng/1.txt");

        w.write("jt是小美女");

        char [] cbuf ={'1','2','3'};
        w.write(cbuf);
        w.close();
    }
    public static void testReader() throws IOException {
        Reader r=new FileReader("e:/03chenhaisheng/1.txt");

  //      char [] buf=new char[1024];
//        int len=r.read(buf);
//        String str=new String(buf,0,len);
//        System.out.println(str);
//

        char []buf=new char[1024];
        int len=0;

        while((len=r.read(buf))!=-1)
        {
            String str=new String(buf,0,len);
            System.out.println(str);
        }
    }
}
